import list_behavior from "../../../behavior/list_behavior";
import {simpleGet, simplePost} from "../../../utils/request";

const app = getApp()
const global = app.globalData

Page({
    behaviors:[list_behavior],
    data: {
        nav: {
            title:"优惠券"
        },
        options:{},
        imageUrl: global.imageUrl,
    },
    onLoad: function (options={}) {
        this.init(options)
    },
    statusChange(e) {
        const {value} = e.detail
        const {list} = this.data
        const where = list.where
        where.coupon_status = value
        this.setData({
            [`list.where`]:where
        })
        this.setList(1)
    },
    init(options){
        console.log({
            coupon_status: options.coupon_status||1,
        })
        this.setData({
            options,
            [`list.url`]: '/user/coupons',
            [`list.where`]:{
                coupon_status: options.coupon_status||1,
            }
        })
        this.setList(1)
    }
});
